using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace CodeStory.SmartUpload.WebControls
{
	public class UploadFileCollection : CollectionBase
	{
		internal UploadFileCollection() {
		}

		public void Add(UploadFile file) {
			List.Add(file);
		}

		public void AddRange(ICollection files) {
			foreach (UploadFile f in files) {
				Add(f);
			}
		}

		public void Remove(UploadFile file) {
			List.Remove(file);
		}
		public new void RemoveAt(int index) {
			List.RemoveAt(index);
		}
		public bool Contains(UploadFile file) {
			return List.Contains(file);
		}
		public new void Clear() {
			List.Clear();
		}
		public int IndexOf(UploadFile file) {
			return List.IndexOf(file);
		}

		public void Insert(int index,UploadFile file) {
			List.Insert(index,file);
		}

		public new int Count {
			get { return List.Count; }
		}

		public void CopyTo(Array array,int index) {
			List.CopyTo(array, index);
		}

		public new IEnumerator GetEnumerator() {
			foreach (object obj in List) {
				yield return (UploadFile)obj;
			}
		}

		public UploadFile this[int index] {
			get {
				return (UploadFile)List[index];
			}
		}
		public UploadFile this[string name] {
			get {
				foreach (UploadFile file in this) {
					if (file.Name.Equals(name))
						return file;
				}
				return null;
			}
		}
	}
}
